package com.ssy.lingxi.member.merchant.api.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

/**
 * 会员信用评估指数枚举
 * @author 万宁
 * @version 2.0.0
 * @date 2020-07-09
 */
public enum MemberCreditTypeEnum {
    /**
     * 交易评价 - 1
     */
    BY_TRADE_COMMENT_FIVE_STARS(1, "交易评价", "交易完成后评价为5分时增加信用积分", 1),

    /**
     * 投诉 - 2
     */
    BY_COMPLAIN(2, "投诉", "投诉经确认属实扣除信用积分", -10),

    /**
     * 售后评价 - 3
     */
    BY_COMMENT_AFTER_TRADE(3, "售后评价", "售后完成后评价为5分时增加信用积分", 1),

    /**
     * 会员年数 - 4
     */
    BY_REGISTER_YEARS(4, "会员年数", "申请成为会员后每满一年增加信用积分", 10);

    private Integer code;
    private Integer defaultPoint;

    MemberCreditTypeEnum(Integer code, String name, String remark, Integer defaultPoint) {
        this.code = code;
        this.defaultPoint = defaultPoint;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.getCode());
    }

    public String getRemark() {
        return LanguageHolder.getName("MemberCreditTypeEnum.r.".concat(String.valueOf(this.getCode())));
    }

    public Integer getDefaultPoint() {
        return defaultPoint;
    }

    public static String getNameByCode(Integer code) {
        return LanguageHolder.getName(MemberCreditTypeEnum.class, code);
    }

    public static String getRemark(Integer code) {
        return LanguageHolder.getName("MemberCreditTypeEnum.r.".concat(String.valueOf(code)));
    }
}
